﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Tavis.Tools {
    public class PathWalker  {

        private readonly List<String> _Segments;
        private int _Position;

        public PathWalker(string path) {
            _Segments = new List<string>(path.Split('/'));
            Position = 0;
        }

        public string ProcessedPath {
            get {
                return String.Join("/", _Segments.Take(Position).ToArray());
            }
        }
        public string UnprocessedPath {
            get {
                return String.Join("/", _Segments.Skip(Position).ToArray());
            }
        }

        public bool IsLastPosition() {
            return _Position == (_Segments.LongCount() - 1);
        }

        public int Position {
            get { return _Position; }
            set { _Position = value; }
        }

        public string CurrentSegment {
            get {
                return _Segments[_Position];
            }
        }
    }
}
